package cn.aitrox.ry.service.image.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Id;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "anno_image")
@CompoundIndexes({ @CompoundIndex(def = "{'group':1, 'groupType':1, 'fileType':1, 'number':1, 'transferMode':1}", unique = true), @CompoundIndex(def = "{'group':1,'groupType':1,'transferMode':1}") })
public class ImageMongoEntity implements Comparable<ImageMongoEntity>{

    public static final String FIELD_GROUP = "group";
    public static final String FIELD_GROUP_TYPE = "groupType";
    public static final String FIELD_NUMBER = "number";
    public static final String FIELD_KEY = "key";
    public static final String FIELD_OSS_TYPE = "ossType";
    public static final String FIELD_FILE_TYPE = "fileType";
    public static final String FIELD_MODE = "mode";

    @Id
    private String id;

    private String group;

    private String groupType;

    private Integer number;

    private String key;

    private String ossType;

    private String fileType;

    private String mode;

    private String info;

    private Date createTime;

    private Date updateTime;

    @Override
    public int compareTo(ImageMongoEntity o) {
        return this.number.compareTo(o.getNumber());
    }
}
